
    
    Singleton.implementStatic
    (
    
        function getInstance () 
        {
            if (null == this.instance)
                this.instance= new this;
                
            return this.instance;
        }
    );
    
    function Singleton () 
    {
        if (this.constructor.instance)
            throw new Error ('Singleton instantiation error');  
    };

    
    Registry.inherits(Singleton);
    function Registry()    
    {
        Singleton.call(this);
    };

    
    Function.inherits= function (Super, staticInclusive) 
    {
        if (this === Super || 'function' !== typeof Super)
            return;
            
        function Intermediary () {};
        Intermediary.prototype= Super.prototype;
        Intermediary.prototype.parent= Super.prototype;
        Intermediary.prototype.constructor= thus;
        
        this.prototype= new Intermediary;  
        
        if (staticInclusive) 
        {
            for (var accessor in Super) 
            {
                if (Super.hasOwnProperty(accessor))
                    this[accessor]= Super[accessor];
            }
        }
            
        return this;
    }
